package com.healthy.mapper;

import com.healthy.entity.Customerprofile;
import com.healthy.entity.Knowledgecontent;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface KnowledgecontentMapper {
    //    查询所有
    @Select("select * from t_knowledgecontent")
    List<Knowledgecontent> culist();

    //    模糊查询
    @Select("SELECT * FROM t_knowledgecontent where problem like '%${problem}%'")
    List<Knowledgecontent> cuSelect(String problem);

    //    外科
    @Select("SELECT * FROM t_knowledgecontent where type ='内科'")
    List<Knowledgecontent> cuInside();

    //    内科
    @Select("SELECT * FROM t_knowledgecontent where type ='外科'")
    List<Knowledgecontent> cuOutside();

    //    添加
    @Insert("insert into t_knowledgecontent (type, problem, answer,doctor) values ( #{knowledgecontent.type},#{knowledgecontent.problem}, #{knowledgecontent.answer},  #{knowledgecontent.doctor})")
    int cuInsert(@Param("knowledgecontent") Knowledgecontent knowledgecontent);

    //删除
    @Delete("delete from t_knowledgecontent where id = #{id}")
    int cuDeleteByid(int id);

    //修改
    @Update("update t_knowledgecontent set type = #{type}, problem = #{problem}, answer = #{answer}, doctor = #{doctor} where id = #{id}")
    int cuUpdateByid(@Param("id") int id,@Param("type") String type,@Param("problem") String problem,@Param("answer") String answer,@Param("doctor") String doctor);

}
